.\"
.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
.\" permission to reproduce portions of its copyrighted documentation.
.\" Original documentation from The Open Group can be obtained online at
.\" http://www.opengroup.org/bookstore/.
.\"
.\" The Institute of Electrical and Electronics Engineers and The Open
.\" Group, have given us permission to reprint portions of their
.\" documentation.
.\"
.\" In the following statement, the phrase ``this text'' refers to portions
.\" of the system documentation.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
.\" Standard for Information Technology -- Portable Operating System
.\" Interface (POSIX), The Open Group Base Specifications Issue 6,
.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
.\" Engineers, Inc and The Open Group.  In the event of any discrepancy
.\" between these versions and the original IEEE and The Open Group
.\" Standard, the original IEEE and The Open Group Standard is the referee
.\" document.  The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" This notice shall appear on any product containing this material.
.\"
.\" The contents of this file are subject to the terms of the
.\" Common Development and Distribution License (the "License").
.\" You may not use this file except in compliance with the License.
.\"
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
.\" or http://www.opensolaris.org/os/licensing.
.\" See the License for the specific language governing permissions
.\" and limitations under the License.
.\"
.\" When distributing Covered Code, include this CDDL HEADER in each
.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
.\" If applicable, add the following below this CDDL HEADER, with the
.\" fields enclosed by brackets "[]" replaced with your own identifying
.\" information: Portions Copyright [yyyy] [name of copyright owner]
.\"
.\"
.\" Copyright 1989 AT&T
.\" Copyright (c) 1994, X/Open Company Limited.  All Rights Reserved.
.\" Portions Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
.\"
.TH FPATHCONF 2 "Sep 1, 2009"
.SH NAME
fpathconf, pathconf \- get configurable pathname variables
.SH SYNOPSIS
.LP
.nf
#include <unistd.h>

\fBlong\fR \fBfpathconf\fR(\fBint\fR \fIfildes\fR, \fBint\fR \fIname\fR);
.fi

.LP
.nf
\fBlong\fR \fBpathconf\fR(\fBconst char *\fR\fIpath\fR, \fBint\fR \fIname\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBfpathconf()\fR and \fBpathconf()\fR functions determine the current
value of a configurable limit or option ( variable ) that is associated with a
file or directory.
.sp
.LP
For \fBpathconf()\fR, the \fIpath\fR argument points to the pathname of a file
or directory.
.sp
.LP
For \fBfpathconf()\fR, the \fIfildes\fR argument is an open file descriptor.
.sp
.LP
The \fIname\fR argument represents the variable to be queried relative to that
file or directory. The variables in the following table come from
<\fBlimits.h\fR> or <\fBunistd.h\fR> and the symbolic constants, defined in
<\fBunistd.h\fR>, are the corresponding values used for \fIname:\fR
.sp

.sp
.TS
box;
c | c | c
l | l | l .
Variable	Value of \fIname\fR	Notes
_
{\fBACL_ENABLED\fR}	\fB_PC_ACL_ENABLED\fR	10
_
{\fBFILESIZEBITS\fR}	\fB_PC_FILESIZEBITS\fR	3,4
_
{\fBLINK_MAX\fR}	\fB_PC_LINK_MAX\fR	1
_
{\fBMAX_CANON\fR}	\fB_PC_MAX_CANON\fR	2
_
{\fBMAX_INPUT\fR}	\fB_PC_MAX_INPUT\fR	2
_
{\fBMIN_HOLE_SIZE\fR}	\fB_PC_MIN_HOLE_SIZE\fR	11
_
{\fBNAME_MAX\fR}	\fB_PC_NAME_MAX\fR	3, 4
_
{\fBPATH_MAX\fR}	\fB_PC_PATH_MAX\fR	4,5
_
{\fBPIPE_BUF\fR}	\fB_PC_PIPE_BUF\fR	6
_
{\fBPOSIX_ALLOC_SIZE_MIN\fR}	\fB_PC_ALLOC_SIZE_MIN\fR	
_
{\fBPOSIX_REC_INCR_XFER_SIZE\fR}	\fB_PC_REC_INCR_XFER_SIZE\fR	
_
{\fBPOSIX_REC_MAX_XFER_SIZE\fR}	\fB_PC_REC_MAX_XFER_SIZE\fR	
_
{\fBPOSIX_REC_MIN_XFER_SIZE\fR}	\fB_PC_REC_MIN_XFER_SIZE\fR	
_
{\fBPOSIX_REC_XFER_ALIGN\fR}	\fB_PC_REC_XFER_ALIGN\fR	
_
{\fBSYMLINK_MAX\fR}	\fB_PC_SYMLINK_MAX\fR	4, 9
_
{\fBXATTR_ENABLED\fR}	\fB_PC_XATTR_ENABLED\fR	1
_
{\fBSATTR_ENABLED\fR}	\fB_PC_SATTR_ENABLED\fR	
_
{\fBXATTR_EXISTS\fR}	\fB_PC_XATTR_EXISTS\fR	1
_
{\fBSATTR_EXISTS\fR}	\fB_PC_SATTR_EXISTS\fR	
_
{\fBACCESS_FILTERING\fR}	\fB_PC_ACCESS_FILTERING\fR	12
_
\fB_POSIX_CHOWN_RESTRICTED\fR	\fB_PC_CHOWN_RESTRICTED\fR	7
_
\fB_POSIX_NO_TRUNC\fR	\fB_PC_NO_TRUNC\fR	3, 4
_
\fB_POSIX_VDISABLE\fR	\fB_PC_VDISABLE\fR	2
_
\fB_POSIX_ASYNC_IO\fR	\fB_PC_ASYNC_IO\fR	8
_
\fB_POSIX_PRIO_IO\fR	\fB_PC_PRIO_IO\fR	8
_
\fB_POSIX_SYNC_IO\fR	\fB_PC_SYNC_IO\fR	8
_
\fB_POSIX_TIMESTAMP_RESOLUTION\fR	\fB_PC_TIMESTAMP_RESOLUTION\fR	1
.TE

.sp
.LP
\fBNotes:\fR
.RS +4
.TP
1.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned
applies to the directory itself.
.RE
.RS +4
.TP
2.
If \fIpath\fR or \fIfildes\fR does not refer to a terminal file, it is
unspecified whether an implementation supports an association of the variable
name with the specified file.
.RE
.RS +4
.TP
3.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned
applies to filenames within the directory.
.RE
.RS +4
.TP
4.
If \fIpath\fR or \fIfildes\fR does not refer to a directory, it is
unspecified whether an implementation supports an association of the variable
name with the specified file.
.RE
.RS +4
.TP
5.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned is
the maximum length of a relative pathname when the specified directory is the
working directory.
.RE
.RS +4
.TP
6.
If \fIpath\fR refers to a FIFO, or \fIfildes\fR refers to a pipe or FIFO,
the value returned applies to the referenced object. If \fIpath\fR or
\fIfildes\fR refers to a directory, the value returned applies to any FIFO that
exists or can be created within the directory. If \fIpath\fR or \fIfildes\fR
refers to any other type of file, it is unspecified whether an implementation
supports an association of the variable name with the specified file.
.RE
.RS +4
.TP
7.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned
applies to any files, other than directories, that exist or can be created
within the directory.
.RE
.RS +4
.TP
8.
If \fIpath\fR or \fIfildes\fR refers to a directory, it is unspecified
whether an implementation supports an association of the variable name with the
specified file.
.RE
.RS +4
.TP
9.
If \fIpath\fR or \fIfildes\fR refers to a directory, the value returned is
the maximum length of the string that a symbolic link in that directory can
contain.
.RE
.RS +4
.TP
10.
If \fIpath\fR or \fIfildes\fR refers to a file or directory in a file
system that supports ACLs, the value returned is the bitwise inclusive OR of
the following flags associated with ACL types supported by the file system;
otherwise 0 is returned.
.sp
.ne 2
.na
\fB\fB_ACL_ACE_ENABLED\fR\fR
.ad
.RS 23n
The file system supports ACE ACLs.
.RE

.sp
.ne 2
.na
\fB\fB_ACL_ACLENT_ENABLED\fR\fR
.ad
.RS 23n
The file system supports UFS aclent ACLs.
.RE

.RE
.RS +4
.TP
11.
If a filesystem supports the reporting of holes (see \fBlseek\fR(2),
\fBpathconf()\fR and \fBfpathconf()\fR return a positive number that represents
the minimum hole size returned in bytes. The offsets of holes returned will be
aligned to this same value. A special value of 1 is returned if the filesystem
does not specify the minimum hole size but still reports holes.
.RE
.RS +4
.TP
12.
If \fIpath\fR or \fIfildes\fR refers to a directory and the file system in
which the directory resides supports access filtering, a non-zero value is
returned. Otherwise, 0 is returned.
.RE
.SH RETURN VALUES
.sp
.LP
If \fIname\fR is an invalid value, both \fBpathconf()\fR and \fBfpathconf()\fR
return \fB\(mi1\fR and \fBerrno\fR is set to indicate the error.
.sp
.LP
If the variable corresponding to \fIname\fR has no limit for the \fIpath\fR or
file descriptor, both \fBpathconf()\fR and \fBfpathconf()\fR return \fB\(mi1\fR
without changing \fBerrno\fR. If \fBpathconf()\fR needs to use \fIpath\fR to
determine the value of \fIname\fR and \fBpathconf()\fR does not support the
association of \fIname\fR with the file specified by \fIpath\fR, or if the
process did not have appropriate privileges to query the file specified by
\fIpath\fR, or \fIpath\fR does not exist, \fBpathconf()\fR returns \fB\(mi1\fR
and \fBerrno\fR is set to indicate the error.
.sp
.LP
If \fBfpathconf()\fR needs to use \fIfildes\fR to determine the value of
\fIname\fR and \fBfpathconf()\fR does not support the association of \fIname\fR
with the file specified by \fIfildes\fR, or if \fIfildes\fR is an invalid file
descriptor, \fBfpathconf()\fR returns \fB\(mi1\fR and \fBerrno\fR is set to
indicate the error.
.sp
.LP
Otherwise \fBpathconf()\fR or \fBfpathconf()\fR returns the current variable
value for the file or directory without changing \fBerrno\fR. The value
returned will not be more restrictive than the corresponding value available to
the application when it was compiled with <\fBlimits.h\fR> or <\fBunistd.h\fR>.
.SH ERRORS
.sp
.LP
The \fBpathconf()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The value of \fIname\fR is not valid.
.RE

.sp
.ne 2
.na
\fB\fBELOOP\fR\fR
.ad
.RS 10n
A loop exists in symbolic links encountered during resolution of the \fIpath\fR
argument.
.RE

.sp
.LP
The \fBfpathconf()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The value of \fIname\fR is not valid.
.RE

.sp
.LP
The \fBpathconf()\fR function may fail if:
.sp
.ne 2
.na
\fB\fBEACCES\fR\fR
.ad
.RS 16n
Search permission is denied for a component of the path prefix.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 16n
An association of the variable \fIname\fR with the specified file is not
supported.
.RE

.sp
.ne 2
.na
\fB\fBENAMETOOLONG\fR\fR
.ad
.RS 16n
The length of the \fIpath\fR argument exceeds {\fBPATH_MAX\fR} or a pathname
component is longer than {\fBNAME_MAX\fR}.
.RE

.sp
.ne 2
.na
\fB\fBENAMETOOLONG\fR\fR
.ad
.RS 16n
As a result of encountering a symbolic link in resolution of the \fIpath\fR
argument, the length of the substituted pathname string exceeded
{\fBPATH_MAX\fR}.
.RE

.sp
.ne 2
.na
\fB\fBENOENT\fR\fR
.ad
.RS 16n
A component of \fIpath\fR does not name an existing file or \fIpath\fR is an
empty string.
.RE

.sp
.ne 2
.na
\fB\fBENOTDIR\fR\fR
.ad
.RS 16n
A component of the path prefix is not a directory.
.RE

.sp
.LP
The \fBfpathconf()\fR function may fail if:
.sp
.ne 2
.na
\fB\fBEBADF\fR\fR
.ad
.RS 10n
The \fIfildes\fR argument is not a valid file descriptor.
.RE

.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
An association of the variable \fIname\fR with the specified file is not
supported.
.RE

.SH USAGE
.sp
.LP
The {\fBSYMLINK_MAX\fR} variable applies only to the \fBfpathconf()\fR
function.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
_
MT-Level	Async-Signal-Safe
_
Standard	See \fBstandards\fR(7).
.TE

.SH SEE ALSO
.sp
.LP
.BR lseek (2),
.BR confstr (3C),
.BR sysconf (3C),
.BR limits.h (3HEAD),
.BR attributes (7),
.BR standards (7)
